Linkedin Java 技術認證題庫


Posted by c9103205 on 2021-07-05

Which statements about abstract classes are true?

1. They can be instantiated.
2. They allow member variables and methods to be inherited by subclasses.
3. They can contain constructors.
  1. 1, 2, and 3
  2. only 3
  3. 2 and 3
  4. only 2

answer: 3
抽象類別的參數可以被子類別繼承,並可以包含建構子,但無法被實例化

Why are ArrayLists better than arrays?

  1. You don't have to decide the size of an ArrayList when you first make it.
  2. You can put more items into an ArrayList than into an array.
  3. ArrayLists can hold more kinds of objects than arrays.
  4. You don't have to decide the type of an ArrayList when you first make it.

answer : 1
出這題的人應該怨念很深,只要被array雷過的應該都有感覺,Java中的array必須宣告大小,這也是筆者認為array不好用的地方,一不小心就會 ArrayIndexOutOfBounds
其餘三點,array也能放入物件
ex:
Integer[] arraySimple = new Integer[10];


#linkedin #java







Related Posts

[Day 0] 第一屆開發者寫作松

[Day 0] 第一屆開發者寫作松

《寫給所有人的運算思維入門》- 寫程式到底是在幹嘛?

《寫給所有人的運算思維入門》- 寫程式到底是在幹嘛?

何謂演算法技術面試?讀《Cracking the Coding Interview(提升程式設計師的面試力)》

何謂演算法技術面試?讀《Cracking the Coding Interview(提升程式設計師的面試力)》


Comments